package com.test.springboot.config;

import com.test.springboot.interceptor.SessionInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class MyWebConfig implements WebMvcConfigurer {
	
	@Autowired
	private SessionInterceptor sessionInterceptor;
	
	@Override
	public void addInterceptors(InterceptorRegistry registry) {
		//.excludePathPatterns() 例外 被拦截资源中的某些
		System.out.println("正在注册sessionInterceptor拦截器");
		registry.addInterceptor(sessionInterceptor).addPathPatterns("/admin/**");
	}
}
